#include "stdafx.h"

#include "MyDInput.h"
#define SAFE_DELETE(x) if(x){x->Release();x=NULL;};

DInput::DInput()
{
	HRESULT hr;
	if(FAILED(hr = DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, 
		IID_IDirectInput8, (void**)&lpdi, NULL)))
		throw(FailToInitDirectInput());
}
const LPDIRECTINPUT8 DInput::getDInput()
{
	return lpdi;
}


DInput::~DInput(void)
{
	SAFE_DELETE(lpdi);
}